<#assign security=JspTaglibs["http://www.springframework.org/security/tags"] />
<!DOCTYPE html>
<html>
<head>
    <#include "../_add.ftl">
    <title>添加</title>
</head>
<body>
<div class="layui-form" id="sysDept-add" action="" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">id：</label>
        <div class="layui-input-inline">
            <input type="text" name="id" lay-verify="required" placeholder="请输入id" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">部门名称：</label>
        <div class="layui-input-inline">
            <input type="text" name="name" lay-verify="required" placeholder="请输入部门名称" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">图标：</label>
        <div class="layui-input-inline">
            <input type="text" name="icon" lay-verify="required" placeholder="请输入图标" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注(简介)：</label>
        <div class="layui-input-inline">
            <input type="text" name="remark" lay-verify="required" placeholder="请输入备注(简介)" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所有父级：</label>
        <div class="layui-input-inline">
            <input type="text" name="level" lay-verify="required" placeholder="请输入所有父级" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">部门外键 上级部门：</label>
        <div class="layui-input-inline">
            <input type="text" name="parentId" lay-verify="required" placeholder="请输入部门外键 上级部门" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态：</label>
        <div class="layui-input-inline">
            <input type="text" name="state" lay-verify="required" placeholder="请输入状态" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">创建时间：</label>
        <div class="layui-input-inline">
            <input type="text" name="createTime" lay-verify="required" placeholder="请输入创建时间" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">修改时间：</label>
        <div class="layui-input-inline">
            <input type="text" name="updateTime" lay-verify="required" placeholder="请输入修改时间" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <button class="layui-btn" lay-submit="" lay-filter="sysDept-form-add" id="sysDept-form-add">立即提交</button>
    </div>
</div>
<script>
    layui.config({
        base: '${request.contextPath}/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(["index", "jquery", "form", "remoteSelect","element"], function () {
        var $ = layui.jquery
            , form = layui.form, remoteSelect = layui.remoteSelect;
        form.on('submit(sysDept-form-add)', function (data) {//点击提交按钮
            var field = data.field; //获取提交的字段
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            var parentTable = parent.layui.table;
            var parentLayer = parent.layer;
            $.ajax({
                url: "/sysDept/add",
                data: field,
                dataType: "json",
                type: "post",
                success: function (msg) {
                    if (msg.code == 0) {
                        parentLayer.msg(msg.msg);//提示后台传过来的信息
                        parentTable.reload('data-sysDept');
                        parentLayer.close(index);
                    } else {
                        parentLayer.msg(msg.msg);//提示后台传过来的信息
                    }
                }
            });
        });

    });
</script>
</body>
</html>